﻿namespace Dexter.Security {
	public interface IEncryptionService {
		/// <summary>
		/// Encrypts the specified value.
		/// </summary>
		/// <param name="value">The value.</param>
		/// <returns>The encrypted value.</returns>
		string EncryptValue ( string value );

		/// <summary>
		/// Decrypts the specified encrypted value.
		/// </summary>
		/// <param name="encryptedValue">The encrypted value.</param>
		/// <returns>The decrypted value.</returns>
		string Decrypt ( string encryptedValue );

		/// <summary>
		/// Create and store a new secure key for encryption.
		/// </summary>
		/// <remarks>I you call this method, all old encrypted values could not be decrypted!</remarks>
		void CreateNewKey ();

		/// <summary>
		/// Create and store a new secure key for encryption.
		/// </summary>
		/// <param name="key">The key.</param>
		/// <remarks>I you call this method, all old encrypted values could not be decrypted!</remarks>
		/// <remarks>If the specified key is <c>null</c> or empty, a random value will replace it.</remarks>
		void CreateNewKey ( string key );

		/// <summary>
		/// Gets a value indicating whether the service as a security key stored.
		/// </summary>
		/// <value>
		/// 	<c>true</c> if there is key associated; otherwise, <c>false</c>.
		/// </value>
		bool IsKeyAssociated { get; }
	}
}